package com.he.service;

import com.he.entity.Hotel;
import com.he.entity.Room;
import com.he.entity.RoomPrice;
import com.he.entity.SearchInfo;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.sort.SortBuilder;
import org.springframework.data.elasticsearch.core.query.ScriptField;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface ISearchService {

    /**
     * 创建索引库
     * @return
     */
    boolean createIndex();

    /**
     * 删除索引库
     */
    boolean deleteIndex();

    /**
     * 添加文档
     */
    boolean insertDoc(Hotel hotel);

    /**
     * 新增客房信息
     * @param room
     * @return
     */
    boolean insertRoom(Room room);

    /**
     * 新增客房每日价格信息
     * @param roomPrices
     * @return
     */
    boolean insertRoomPrice(Integer hid, List<RoomPrice> roomPrices);

    boolean updateRoomPrice(Integer hid, RoomPrice roomPrice);

    boolean updateRoomNumber(Integer hid, Integer rid, Integer number, Date beginTime, Date endTime);


    /**
     * 修改文档
     * @return
     */
    boolean updateDoc(Map<String, Object> params, Integer id);

    /**
     * 删除文档
     */
    boolean deleteDocById(Integer id);

    void syncDataBase();

    List<Hotel> searchByKeyWord(SearchInfo searchInfo);

    //List<Hotel> search(QueryBuilder queryBuilder);
    //List<Hotel> search(QueryBuilder queryBuilder, ScriptField... scriptFields);
    List<Hotel> search(QueryBuilder queryBuilder, List<SortBuilder> sort, ScriptField... scriptFields);

    void updateHotelDjl(Integer hid,Integer djl);

}
